﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration.Provider;

namespace SCRUM.Core.MembershipProviders
{
    /// <summary>
    /// A configuration section collection for web.config.
    /// </summary>
    public class MembershipDataProviderCollection : ProviderCollection
    {
        /// <summary>
        /// Gets a provider by its name.
        /// </summary>
        /// <param name="name">The name of the provider.</param>
        public new MembershipDataProvider this[string name]
        {
            get { return (MembershipDataProvider)base[name]; }
        }

        /// <summary>
        /// Add a provider to the collection.
        /// </summary>
        /// <param name="provider">The provider.</param>
        public override void Add(ProviderBase provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            if (!(provider is MembershipDataProvider))
            {
                throw new ArgumentException("Invalid provider type", "provider");
            }

            base.Add(provider);
        }
    }
}
